<?php

namespace addons\Flow\common\models;

use Yii;
use common\models\merchant\Merchant;

/**
 * This is the model class for table "{{%addon_flow_workflow}}".
 *
 * @property int $id
 * @property int $status 状态
 * @property string $created_at 创建时间
 * @property string $updated_at 更新时间
 */
class Workflow extends \common\models\base\BaseModel
{

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%addon_flow_workflow}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [
            [['id', 'title', 'initial_status_id'], 'required'],
            [['id', 'title','initial_status_id'], 'string', 'max' => 35],
            [['merchant_id','sort', 'status'], 'integer'],

        ];
    }

    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => '工作流ID',
            'title' => '工作流名',
            'description' => '描述',
            'initial_status_id' => '初始状态',
            'sort' => '排序',
            'status' => '状态',
        ];
    }

    public function getMerchant()
    {
        return $this->hasOne(Merchant::class, ['id' => 'merchant_id']);
    }
}
